﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using BLL;

namespace DAL
{
    public class AuthorityRepository : IAuthorityRepository
    {
        public List<BLL.Authority> Search()
        {
            string searchSql = "select AuthorityName from Authority";

            DataTable searchDataTable = DbHelperSql.ExecuteDataTable(searchSql);
            List<BLL.Authority> authorityList = new List<BLL.Authority>();
            foreach (DataRow dr in searchDataTable.Rows)
            {
                Authority authority = new Authority();
                authority.AuthorityName = (string)dr["AuthorityName"];
                authority.AuthorityId=(int)(dr["AuthorityId"]);

                authorityList.Add(authority);

            }

            return authorityList;
        }


        //void IAuthorityShow.Search()
        //{
        //    throw new NotImplementedException();
        //}
    }
}
